#include "profilegroupseparator.h"
#include <QPainter>
#include <QPalette>
#include <QPaintEvent>

ProfileGroupSeparator::ProfileGroupSeparator(QWidget *parent) :
    QWidget(parent)
{
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
}

void ProfileGroupSeparator::setText(const QString &text)
{
    m_text = text;
}

int ProfileGroupSeparator::minimumHeight() const
{
    return 20;
}

QSize ProfileGroupSeparator::sizeHint() const
{
    return QSize(20, 20);
}

void ProfileGroupSeparator::paintEvent(QPaintEvent *)
{
    QPainter p(this);
    QPalette palette;
    QFontMetrics fm(p.font());

    p.setRenderHint(QPainter::Antialiasing, true);

    p.setPen(palette.color(QPalette::Text));
    p.drawText(5, fm.height(), m_text);


    p.drawLine(0, fm.height() + 2, width(), fm.height() + 2);
}
